#!/bin/bash
# File Name: progress.sh
# Author: moshan
# mail: mo_shan@yeah.net
# Created Time: 2019-04-24 17:13:51
# Function: show progress bar.
#########################################################################
mark=('|' '/' '-' '\') 
for ((i=0;i<=100;i++))
do
	index=$((${i}%4))
	if [ ${i} -eq 100 ]
	then
		mark[0]=""
	fi
	printf "[\033[33m%-100s\033[0m\033[32m %d%%\033[0m\033[35m%c\033[0m]\r" "${str}" "${i}" "${mark[${index}]}"
	sleep 0.1
	str=${str}"#"
done 
printf "\n"
